import { getStore } from '@/util/store'

const dic = {
  apply_type: [
    { label: '客户指定供方', value: '1' },
    { label: '开发储蓄供应商', value: '2' },
    { label: '现有供方无法满足公司需求', value: '3' },
    { label: '其他', value: '4' }
  ],
  status_type: [
    { label: '草稿', value: '1' },
    { label: '审批中', value: '2' },
    { label: '审批通过', value: '3' },
    { label: '审批拒绝', value: '4' },
    { label: '已作废', value: '5' }
  ],
  factory_type: []
}

export const option = function () {
  return {
    labelWidth: 120,
    emptyBtn: false,
    submitBtn: false,
    detail: false,
    column: [
      {
        label: '认证申请单号',
        prop: 'applyNo',
        disabled: true,
        span: 8
      },
      {
        label: '创建人',
        span: 8,
        prop: 'creater',
        maxlength: 100,
        disabled: true,
        value: getStore({ name: 'userInfo' }).user_name
      },
      {
        label: '创建日期',
        span: 8,
        prop: 'createTime',
        type: 'date',
        format: 'yyyy-MM-dd',
        valueFormat: 'yyyy-MM-dd',
        maxlength: 100,
        disabled: true,
        value: new Date()
      },
      {
        label: '供应商名称',
        prop: 'supplierName',
        formslot: true,
        rules: [
          {
            required: true,
            message: '请输入供应商名称',
            trigger: 'blur'
          }
        ],
        span: 8
      },
      {
        label: '供应商编码',
        prop: 'supplierCode',
        disabled: true,
        span: 8
      },
      {
        label: '供应商身份',
        prop: 'supplierIdentity',
        disabled: true,
        span: 8
      },
      {
        label: '物料分类',
        prop: 'materialCategory',
        rules: [
          {
            required: true,
            message: '请选择物料分类',
            trigger: 'change'
          }
        ],
        span: 8
      },
      {
        label: '物料品类',
        prop: 'materialClassify',
        maxlength: 50,
        span: 8
      },
      {
        label: '供应商类型',
        prop: 'supplierType',
        maxlength: 50,
        span: 8
      },

      {
        label: '申请原因',
        type: 'select',
        prop: 'applyReason',
        dicData: dic.apply_type,
        props: {
          label: 'label',
          value: 'value'
        },
        rules: [
          {
            required: true,
            message: '请选择申请原因',
            trigger: 'change'
          }
        ],
        span: 8
      },
      {
        label: '负责人',
        prop: 'chargePerson',
        maxlength: 50,
        span: 8
      },
      {
        label: '供应工厂',
        prop: 'supplierFactory',
        type: 'select',
        span: 8,
        dicData: dic.factory_type,
        multiple: true,
        props: {
          label: 'label',
          value: 'value'
        }
      },
      {
        label: '备注',
        prop: 'remark',
        type: 'textarea',
        maxlength: 500,
        minRows: 6,
        maxRows: 8,
        span: 24
      }
    ]
  }
}
